#include <bits/stdc++.h>
using namespace std;

class ListNode{
public:
	int data;
	ListNode* next;
};


class Test{
public:
	int getLen(ListNode* head){
		int len = 0;
		ListNode* cur = head->next;
		while(cur){
			len++;
		}
		return len;
	}
	
	
	ListNode *getIntersectionNode(ListNode *headA, ListNode *headB) {
		int lenA = getLen(headA);
		int lenB = getLen(headB);
		ListNode* curA = headA;
		ListNode* curB = headB;
		if(lenA < lenB){
			swap(lenA,lenB);
			swap(curA,curB);
		}
		int n = lenA - lenB;
		while(n--){
			curA = curA->next;
		}
		while(curA && curB){
			if(curA == curB){
				return curA;
			}
			curA = curA->next;
			curB = curB->next;
		}
		return NULL;
	}
};


int main(){
	
	return 0;
}
